/*
 * Copyright 2021-2030 itbox.cn All right reserved. This software is the confidential and proprietary information
 * of itbox.cn ("Confidential Information"). You shall not disclose such Confidential Information and shall use it
 * only in accordance with the terms of the license agreement you entered into with itbox.cn.
 */
package cn.itbox.example.application.service.impl;

import cn.itbox.uap.db.model.PageResult;
import cn.itbox.example.service.RoleService;
import cn.itbox.example.model.request.CreateRoleRequest;
import cn.itbox.example.model.request.UpdateRoleRequest;
import cn.itbox.example.model.response.RoleResponse;
import cn.itbox.example.model.request.RolePageRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @BelongProject springboot-study
 * @BelongPackage cn.itbox.example.application.service.impl
 * @Description TODO
 * @ClassName RoleCommandServiceImpl
 * @Author xingc
 * @Date 2023/11/26 23:14
 * @Version 1.0.0
 */
@Slf4j
@Service
@DubboService(interfaceClass = RoleService.class, protocol = "dubbo")
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleCommandServiceImpl roleCommandService;

    @Autowired
    private RoleQueryServiceImpl roleQueryService;

    @Override
    public Long create(CreateRoleRequest request) {
        return roleCommandService.create(request);
    }

    @Override
    public void update(UpdateRoleRequest request) {
        roleCommandService.update(request);
    }

    @Override
    public void delete(Long id) {
        roleCommandService.delete(id);
    }

    @Override
    public RoleResponse byId(Long id) {
        return roleQueryService.byId(id);
    }

    @Override
    public List<RoleResponse> list() {
        return roleQueryService.list();
    }

    @Override
    public PageResult<RoleResponse> pageList(Long pageIndex, Long pageSize) {
        return roleQueryService.pageList(pageIndex, pageSize);
    }

    @Override
    public PageResult<RoleResponse> pageList(RolePageRequest request) {
        return roleQueryService.pageList(request);
    }
}
